import { createApp } from "vue";
import App from "./App.vue";
import elementplus from "element-plus";
import "@/assets/style/index.css";
import "element-plus/dist/index.css";
import "@/assets/style/style.css";
import "@/assets/style/common.scss";
import "@/assets/style/element-reset.scss";
import "@/assets/style/element/index.scss";
import "@/assets/icons/index.js";
import "virtual:svg-icons-register";
import { createPinia } from "pinia";
import i18n from "@/locales/index.js";
import router from "@/router/index.js";
import * as ElIcons from "@element-plus/icons-vue";
import { hcDirectives, glbComponents } from "@hc/common";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import "@/router/permission.js";
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);

let app = createApp(App);

// 全局注册自定义指令
Object.keys(hcDirectives).forEach((key) => {
  app.directive(key, hcDirectives[key]);
});

Object.keys(glbComponents).forEach((name) => {
  app.component(name, glbComponents[name]);
});

for (const name in ElIcons) {
  app.component(name, ElIcons[name]);
}

app.use(elementplus).use(pinia).use(router).use(i18n).mount("#app");
